package com.hkpw.system;

import com.hkpw.system.service.IDoorEventNotifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Auther: Andy
 * @Date: 2022/10/12 14:28
 * @Description: FaceMiddleTask
 * @Version 1.0.0
 */
@Slf4j
@Component("doorEventTask")
public class DoorEventTask {

    @Autowired
    private IDoorEventNotifyService doorEventNotifyService;

    /**
     * 清理指定天数之前的出入记录
     *
     * @param days 天数
     */
    public void deleteDoorEventBeforeDays(Integer days) {
        log.info("[门禁定时任务]开始清理过期门禁定时任务，清理{}天之前数据。", days);
        int result = doorEventNotifyService.deleteDoorEventNotifyBeforeDays(days);
        log.info("[门禁定时任务]清理完成，清理条数：{}!", result);
    }

    /**
     * 清理指定天数之前的非人脸识别的冗余出入记录
     * @param days
     */
    public void cleanUselessDoorEventNotify(Integer days){
        log.info("[门禁定时任务]开始清理过期门禁定时任务，清理{}天之前的非人脸识别数据。", days);
        int result = doorEventNotifyService.cleanUselessDoorEventNotify(days);
        log.info("[门禁定时任务]清理完成，清理条数：{}!", result);
    }


}
